{#{% load staticfiles %}#}
<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>首页</title>
		<link rel="stylesheet" href="{% static 'css/common.css' %}" />
		<style>
			.table {
				position: relative;
				width: 50%;
				min-width: 300px;
				height: 50%;
				min-height: 400px;
				top: 100px;
				text-align: center;
				margin-left: auto;
				margin-right: auto;
				border: 1px solid black;
				border-collapse:collapse;
			}

			.textarea{
				height: 100%;
				width: 99%;
			}
		</style>
        <script type="text/javascript" src="{% static 'js/jquery.js' %}"></script>
		<script>
            function check() {
                var music=$("#musicfile").val();
                var text=$("#textfile").val();
                if(music!="" && music.substring(music.lastIndexOf(".")).toUpperCase()!="MP3"){
                    alert(music.substring(music.lastIndexOf("."))+"音乐文件格式错误");
                    return false;
                }
                if(text!="" && text.substring(text.lastIndexOf(".")).toUpperCase()!="TXT"){
                    alert(text.substring(text.lastIndexOf("."))+"文本文件格式错误");
                    return false;
                }
                var txtwrite=$.trim($("#txtwrite").val());
                $("#txtwrite").val(txtwrite);
                return true;
            }
            function tt() {
                var txtwrite=$.trim($("#txtwrite").val());
                alert(123)

            }
		</script>
	</head>

	<body>
		<div class="divbottom">
            <button onclick="tt()"> {{ STATIC_URL }}测试</button>
            <img src="{{ STATIC_URL }}yamy1.jpg">
            <form action="test/" method="post"  enctype="multipart/form-data" onsubmit="return check();">
                {% csrf_token %}
				<table class="table">
					<tr>
						<td width="200px">Music(以.mp3结尾)</td>
						<td><input type="file" name="musicfile" id="musicfile" /></td>
					</tr>
					<tr>
						<td>Text(以.txt结尾)</td>
						<td><input type="file" name="textfile" id="textfile" /></td>
					</tr>
					<tr>
						<td>手写文字</td>
						<td><textarea name="textarea" class="textarea" id="txtwrite" name="txtwrite"></textarea></td>
					</tr>
					<tr>
						<td colspan="2"><input type="submit" /></td>
					</tr>
				</table>
			</form>
		</div>
	</body>

</html>